<template>
	<view class="exam-content">
		<!-- 第一步 考试须知 -->
		<Notice :buyInfo="buyInfo" @getSteps="getSteps" v-if="steps == 1"></Notice>
		<!-- 考试中... -->
		<Examination @getSteps="getSteps" v-if="steps == 2"></Examination>
		<!-- 考试结果 -->
		<ExamResult @getSteps="getSteps" v-if="steps == 3"></ExamResult>
	</view>
</template>

<script>
	import Notice from "./components/instructions"
	import Examination from "./components/examination"
	import ExamResult from "./components/examResult"
	export default {
		data() {
			return {
				steps: 1,
				buyInfo: {
					isBuy: false,
					tryNum: 3
				}
			}
		},
		components: {
			Notice,
			Examination,
			ExamResult
		},
		watch:{
			steps(newValue,oldValue){
				if(newValue == 2){
					uni.setNavigationBarTitle({
						title: '考试'
					});
				}
				if(newValue == 3){
					uni.setNavigationBarTitle({
						title: '考试结果'
					});
				}
			}
		},
		methods: {
			// 获取组件种传回来的步骤数
			getSteps(steps) {
				console.log(steps,'步数');
				this.$nextTick(()=>{
					this.steps = steps
				})
			},
		}
	}
</script>

<style lang="scss">
	
</style>